package cn.edu.cxcyzx.util;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Room_useInfo implements Comparable<Room_useInfo>{
	private int projectId;
	private String check_date;
	private int count;
	public Room_useInfo(){}
	public Room_useInfo(int projectId,String check_date,int count){
		this.projectId=projectId;
		this.check_date=check_date;
		this.count=count;
	}
	public int getProjectId() {
		return projectId;
	}
	public void setProjectId(int projectId) {
		this.projectId = projectId;
	}
	public String getCheck_date() {
		
		return check_date;
	}
	public void setCheck_date(String check_date) {
		this.check_date=check_date;
	}
	public int getCount() {
		return count;
	}
	public void setCount(int count) {
		this.count = count;
	}
	
	public int add_count(int count){
		this.setCount(this.count+count);
		return this.getCount();
	}
	
	
	@Override
	public String toString() {
		return "Room_useInfo [projectId=" + projectId + ", check_date="
				+ check_date + ", count=" + count + "]";
	}
	@Override
	public int compareTo(Room_useInfo o) {
		// TODO Auto-generated method stub
		DateFormat format=new SimpleDateFormat("yyyy-MM-dd");
		String o_date=o.getCheck_date();
		Date o_d=null;
		try {
			o_d = format.parse(o_date);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		Date o_dd=null;
		try {
			o_dd = format.parse(this.check_date);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return o_dd.getTime()>o_d.getTime()?1:-1;
	}
	
	
}
